<template>
  <div>
    <el-form ref="form" :model="form" :rules="dailyFormRules" label-position="top" class="form" :show-message="false" :hide-required-asterisk="true">
      <el-form-item :label="item.label" v-for="(item,index) in dailyFormConfin" :key="index" :prop="item.prop">
        <el-input v-model="form[item.prop]" :placeholder="item.placeholder" v-if="type"></el-input>
        <div v-else class="form-text">{{ form[item.prop] }}</div>
      </el-form-item>
    </el-form>
  </div>
</template>
<script>
import { dailyFormConfin, dailyFormRules } from "./confin";
export default {
  props: {
    type: {
      type: Boolean, // false: 查看详情 true:表单编辑
      default: false
    }
  },
  data() {
    return {
      dailyFormConfin,
      form: {
        // 总体情况
        eventMonitor: "",
        // 二、重要事项
        importantNotes: "",
        // 三、安全生产情况：
        safeProduct: "",
        // 四、值班员日常工作情况：
        resourceVerification: "",
        // 五、供电保障情况
        powerWork: "",
        // 预警及响应情况
        warningDeal: "",
        // 值班重要事项
        materialNotes: "",
        // 其他情况
        other: ""
      },
      dailyFormRules
    };
  },
  methods: {
    resetForm() {
      this.$refs.form.resetFields();
    }
  }
};
</script>
<style lang="less" scoped>
.form {
  :deep(.el-form-item__label) {
    font-size: 18px;
    font-weight: 700;
  }
  .form-title {
    position: absolute;
    top: -48px;
    left: 166px;
    :deep(.el-input__inner) {
      font-weight: 700;
    }
  }
  .form-text {
    font-size: 18px;
    text-indent: 2em;
    padding-left: 10px;
  }
}
</style>
